using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using Microsoft.Win32;

namespace Tortuga.Core {
	public class TortoiseProcess : Process {
		public TortoiseProcess() : this(GetTortoiseProcPathFromRegistry(Registry.LocalMachine)) { }

		public TortoiseProcess(string tortoisePath) {
			this.EnableRaisingEvents = true;
			this.StartInfo.FileName = tortoisePath;
		}

		public static string GetTortoiseProcPathFromRegistry(RegistryKey key) {
			return key.OpenSubKey(@"SOFTWARE\TortoiseSVN\").GetValue("ProcPath", "").ToString();
		}

		public void ExecuteCommand(string cmd) {
			this.StartInfo.Arguments = cmd;
			this.Start();

		}

		public void ExecuteCommand(Tortuga.Core.TortoiseCommands.TortoiseCommand cmd) {
			ExecuteCommand(cmd.ToString());
		}
	}
}
